<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="x5-fullscreen" content="true" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta
      name="description"
      content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
    />

    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon/favicon.ico" />
    <title>graphic 数据图层 | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

    <script
      type="text/javascript"
      src="/lib/include-lib.js"
      libpath="/lib/"
      include="jquery,layer,toastr,font-awesome,bootstrap,bootstrap-checkbox,haoutil,mars3d,es5-widget"
    ></script>

    <link href="/css/style.css" rel="stylesheet" />
  </head>

  <body class="dark">
    <div id="mars3dContainer" class="mars3d-container"></div>

    <!-- 面板 -->
    <div class="infoview">
      <div>
        图层状态：
        <div class="checkbox checkbox-primary checkbox-inline">
          <input id="chkShow" class="styled" type="checkbox" checked />
          <label for="chkShow"> 显示隐藏 </label>
        </div>
        <div class="checkbox checkbox-primary checkbox-inline">
          <input id="chkPopup" class="styled" type="checkbox" checked />
          <label for="chkPopup"> Popup绑定 </label>
        </div>
        <div class="checkbox checkbox-primary checkbox-inline">
          <input id="chkTooltip" class="styled" type="checkbox" />
          <label for="chkTooltip"> Tooltip绑定 </label>
        </div>
        <div class="checkbox checkbox-primary checkbox-inline">
          <input id="chkContextMenu" class="styled" type="checkbox" checked />
          <label for="chkContextMenu"> 右键菜单绑定 </label>
        </div>
      </div>

      <div>
        <span>点状(单个坐标)：</span>
        <a href="/editor-es5.html?id=graphic/entity/label" target="_blank" class="btn btn-default">文字</a>
        <a href="/editor-es5.html?id=graphic/entity/point" target="_blank" class="btn btn-default">点</a>
        <a href="/editor-es5.html?id=graphic/entity/billboard" target="_blank" class="btn btn-default">图标点</a>
        <a href="/editor-es5.html?id=graphic/entity/plane" target="_blank" class="btn btn-default">平面</a>
        <a href="/editor-es5.html?id=graphic/entity/box" target="_blank" class="btn btn-default">盒子</a>
        <a href="/editor-es5.html?id=graphic/entity/circle" target="_blank" class="btn btn-default">圆</a>
        <a href="/editor-es5.html?id=graphic/entity/cylinder" target="_blank" class="btn btn-default">圆锥</a>
        <a href="/editor-es5.html?id=graphic/entity/ellipsoid" target="_blank" class="btn btn-default">球</a>
        <a href="/editor-es5.html?id=graphic/entity/model" target="_blank" class="btn btn-default">小模型</a>
      </div>
      <div>
        <span>线面状(多个坐标)：</span>
        <a href="/editor-es5.html?id=graphic/entity/polyline" target="_blank" class="btn btn-default">线</a>
        <a href="/editor-es5.html?id=graphic/entity/polylineVolume" target="_blank" class="btn btn-default">管道</a>
        <a href="/editor-es5.html?id=graphic/entity/corridor" target="_blank" class="btn btn-default">走廊</a>
        <a href="/editor-es5.html?id=graphic/entity/wall" target="_blank" class="btn btn-default">墙</a>
        <a href="/editor-es5.html?id=graphic/entity/rectangle" target="_blank" class="btn btn-default">矩形</a>
        <a href="/editor-es5.html?id=graphic/entity/polygon" target="_blank" class="btn btn-default">面</a>
      </div>
    </div>

    <script src="/js/common.js"></script>
    <script src="/js/layer_state.js"></script>

    <script src="./map.js"></script>

    <script type="text/javascript">
      "use script" //开发环境建议开启严格模式

      function initUI(options) {
        //图层管理的相关处理

        bindAttributePannel()
        //2.在layer上绑定监听事件
        initLayerManager()
      }

      //在图层级处理一些事物
      function initLayerManager() {
        //可在图层上绑定popup,对所有加到这个图层的矢量数据都生效

        $("#chkPopup").change(function () {
          let val = $(this).is(":checked")

          bindPopup(graphicLayer, val)
        })

        //可在图层上绑定tooltip,对所有加到这个图层的矢量数据都生效
        $("#chkTooltip").change(function () {
          let val = $(this).is(":checked")
          bindTooltip(graphicLayer, val)
        })

        $("#chkContextMenu").change(function () {
          let val = $(this).is(":checked")

          bindRinghtMenu(graphicLayer, val)
        })

        $("#chkHasEdit").change(function () {
          let val = $(this).is(":checked")

          // graphicLayer.hasEdit = val //启用编辑
        })

        //显示隐藏
        $("#chkShow").change(function () {
          let val = $(this).is(":checked")
          isShowLayer(graphicLayer, val)
        })

        $("#btnClear").click(function () {
          // graphicLayer.clear()
        })

        $("#btnExpFile").click(function () {
          // window.layer.msg('该功能在开发完善中……')
          // return
          // if (graphicLayer.length === 0) {
          //   window.layer.msg("当前没有标注任何数据，无需保存！")
          //   return
          // }
          // let geojson = graphicLayer.toGeoJSON()
          // haoutil.file.downloadFile("我的标注.json", JSON.stringify(geojson))
        })

        $("#btnImpFile").click(function () {
          $("#input_draw_file").click()
        })

        function clearSelectFile() {
          if (!window.addEventListener) {
            document.getElementById("input_draw_file").outerHTML += "" //IE
          } else {
            document.getElementById("input_draw_file").value = "" //FF
          }
        }
      }
      //简化geojson的坐标
      function simplifyGeoJSON(geojson) {
        try {
          geojson = turf.simplify(geojson, { tolerance: 0.000001, highQuality: true, mutate: true })
        } catch (e) {
          //
        }
        return geojson
      }
    </script>
  </body>
</html>
